<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a rel="nofollow" href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <div class="product-info">
    <div class="left">
      <div id="proListZoom">
      	<div id="proImgListUp"></div>
        <ul id="proImgList">
	      <li class="thumbActive" rel="{smallimage: '<?php echo $image_thumb; ?>'<?php if ($image_big) { echo ",largeimage: '" .  $image_big . "'";} ?>}" title="<?php echo $heading_title; ?>">
	        <img src="<?php echo $image_add; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>"/>
	      </li>
      	  <?php if ($images) { ?>
	        <?php foreach ($images as $image) { ?>
	      <li rel="{smallimage: '<?php echo $image['thumb']; ?>'<?php if ($image['big']) { echo ",largeimage: '" .  $image['big'] . "'";} ?>}" title="<?php echo $heading_title; ?>">
	        <img src="<?php echo $image['add']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>"/>
	      </li>
	        <?php } ?>
	      <?php } ?>
        </ul>
      	<div id="proImgListDown"></div>
      </div>
      <div id="proShowZoom" <?php if ($image_big) { echo 'href="' .  $image_big . '"';} ?> title="<?php echo $heading_title; ?>">
      	<img src="<?php echo $image_thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>">
      </div>
    </div>
    <div class="right">
  	  <h2><?php echo $heading_title; ?></h2>
      <?php if ($price) { ?>
      <div class="price"><b><?php echo $text_price; ?></b>
        <?php if (!$special) { ?>
        <?php echo $price; ?>
        <?php } else { ?>
        <span class="price-old"><?php echo $price; ?></span><span class="price-new"><?php echo $special; ?></span>
        <?php } ?>
      </div>
      <?php } ?>
      <?php if ($options) { ?>
      <div class="options">
        <?php foreach ($options as $option) { ?>
        <?php if ($option['type'] == 'select') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
          <?php if ($option['required']) { ?>
          <span class="required">*</span>
          <?php } ?>
          <b><?php echo $option['name']; ?>:</b>
          <select name="option[<?php echo $option['product_option_id']; ?>]">
            <option value=""><?php echo $text_select; ?></option>
            <?php foreach ($option['option_value'] as $option_value) { ?>
            <option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php } ?>
            </option>
            <?php } ?>
          </select>
        </div>
        <?php } ?>
        <?php if ($option['type'] == 'radio') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
          <?php if ($option['required']) { ?>
          <span class="required">*</span>
          <?php } ?>
          <b><?php echo $option['name']; ?>:</b>
          <?php foreach ($option['option_value'] as $option_value) { ?>
          <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
          <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php } ?>
          </label>
          <?php } ?>
        </div>
        <?php } ?>
        <?php if ($option['type'] == 'checkbox') { ?>
        <div id="option-<?php echo $option['product_option_id']; ?>" class="option">
          <?php if ($option['required']) { ?>
          <span class="required">*</span>
          <?php } ?>
          <b><?php echo $option['name']; ?>:</b>
          <?php foreach ($option['option_value'] as $option_value) { ?>
          <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
          <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
            <?php if ($option_value['price']) { ?>
            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
            <?php } ?>
          </label>
          <?php } ?>
        </div>
        <br />
        <?php } ?>
        <?php } ?>
      </div>
      <?php } ?>
      <div class="cart">
        <div><?php echo $text_qty; ?>
          <input type="text" name="quantity" size="2" value="<?php echo $minimum; ?>" />
          <input type="hidden" name="product_id" size="2" value="<?php echo $product_id; ?>" />
          &nbsp;
          <input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
          &nbsp;&nbsp;&nbsp;&nbsp;
          <input type="button" value="<?php echo $button_wishlist; ?>" onclick="addToWishList('<?php echo $product_id; ?>');" class="button" />
        </div>
        <?php if ($minimum > 1) { ?>
        <div class="minimum"><?php echo $text_minimum; ?></div>
        <?php } ?>
      </div>
      <?php if ($review_status) { ?>
      <div class="review">
        <div class="review-head">
        	<img src="catalog/view/theme/default/image/stars-<?php echo $rating; ?>.png" alt="<?php echo $reviews; ?>" />
        	<a href="<?php echo $morereviews; ?>" target="_blank"><?php echo $reviews; ?></a>
        	<span>|</span>
        	<a rel="nofollow" href="<?php echo $productPath;?>#tab-review" onclick="$('a[tabtarget=\'#tab-review\']').trigger('click');"><?php echo $text_write; ?></a>
        	<span>|</span>
        	<!-- AddThis Button BEGIN -->
            <div class="addthis_default_style"><a rel="nofollow" class="addthis_button_compact"><?php echo $text_share; ?></a>
				<a rel="nofollow" class="addthis_button_facebook"></a>
				<a rel="nofollow" class="addthis_button_twitter"></a>
			</div>
          	<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script> 
            <!-- AddThis Button END --> 
        </div>
        <?php if ($reviewList) { ?>
        <div class="review-content">
	    <?php foreach ($reviewList as $reviewItem) { ?>
	    <div class="review-list">
	      <div class="author"><b><?php echo $reviewItem['author']; ?></b> <?php echo $text_on; ?> <?php echo $reviewItem['date_added']; ?></div>
	      <div class="rating"><img src="catalog/view/theme/default/image/stars-<?php echo $reviewItem['rating'] . '.png'; ?>" alt="<?php echo $reviewItem['reviews']; ?>" /></div>
	      <div class="text"><?php echo $reviewItem['text']; ?></div>
	    </div>
	    <?php } ?>
	    </div>
	    <?php } ?>
      </div>
      <?php } ?>
    </div>
  </div>
  <?php if ($products || $tags) { ?>
  <div class="product-relate">
    <div class="relate-head">
    <span><?php if ($products && $tags) { echo $text_related_kw; } else if ($products){ echo $text_related; } else { echo $text_tags; } ?></span>
    <?php if ($tags) { ?>
  	  <?php foreach ($tags as $tag) { ?>
        <a href="<?php echo $tag['href']; ?>"><h2><?php echo $tag['tag']; ?></h2></a>
      <?php } ?>
    <?php } ?>
    </div>
    <?php if ($products) { foreach ($products as $product) { ?>
    <div class="relate-product">
    <?php if ($product['thumb']) { ?>
    <div><a target="_blank" href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
    <?php } ?>
    <div style="height:30px;overflow: hidden;"><a target="_blank" href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
    <?php if ($product['price']) { ?>
    <div>
      <?php if (!$product['special']) { ?>
      <?php echo $product['price']; ?>
      <?php } else { ?>
      <?php echo $product['special']; ?>
      <?php } ?>
    </div>
    <?php } ?>
    </div>
    <?php }} ?>
  </div>
  <?php } ?>
  <div id="tabs" class="htabs">
    <a rel="nofollow" tabtarget="#tab-description"><?php echo $tab_description; ?></a>
    <?php if ($review_status) { ?>
    <a rel="nofollow" href="<?php echo $productPath;?>#tab-review" tabtarget="#tab-review"><?php echo $tab_review; ?></a>
    <?php } ?>
  </div>
  <div id="tab-description" class="tab-content">
  	<?php if ($discounts) { ?>
    <div class="discount">
    <?php foreach ($discounts as $discount) { ?>
    <?php echo sprintf($text_discount, $discount['quantity'], $discount['price']); ?><br />
    <?php } ?>
    </div>
    <?php } ?>
  	<?php if ($attribute_groups) { ?>
    <table class="attribute">
      <?php foreach ($attribute_groups as $attribute_group) { ?>
      <thead>
        <tr>
          <td colspan="2"><?php echo $attribute_group['name']; ?></td>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
        <tr>
          <td><?php echo $attribute['name']; ?></td>
          <td><?php echo $attribute['text']; ?></td>
        </tr>
        <?php } ?>
      </tbody>
      <?php } ?>
    </table>
    <?php } ?>
  	<?php echo $description; ?>
  </div>
  <?php if ($review_status) { ?>
  <div id="tab-review" class="tab-content">
    <h2 id="review-title"><?php echo $text_write; ?></h2>
    <b><?php echo $entry_name; ?></b><br />
    <input type="text" name="name" value="" />
    <br />
    <b><?php echo $entry_review; ?></b>
    <textarea name="text" cols="40" rows="8" style="width: 98%;"></textarea>
    <span style="font-size: 11px;"><?php echo $text_note; ?></span><br />
    <br />
    <b><?php echo $entry_rating; ?></b> <span><?php echo $entry_bad; ?></span>&nbsp;
    <input type="radio" name="rating" value="1" />
    &nbsp;
    <input type="radio" name="rating" value="2" />
    &nbsp;
    <input type="radio" name="rating" value="3" />
    &nbsp;
    <input type="radio" name="rating" value="4" />
    &nbsp;
    <input type="radio" name="rating" value="5" />
    &nbsp;<span><?php echo $entry_good; ?></span><br />
    <br />
    <b><?php echo $entry_captcha; ?></b><br />
    <input type="text" name="captcha" value="" />
    <br />
    <img src="index.php?route=product/product/captcha" alt="" id="captcha" /><br />
    <br />
    <div class="buttons">
      <div class="right"><a id="button-review" class="button"><?php echo $button_continue; ?></a></div>
    </div>
  </div>
  <?php } ?>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
$(document).ready(function() {
	$('#proShowZoom').jqzoom({
    	zoomType: 'standard',
        lens:true,
        preloadImages: false,
        alwaysOn:false
    });
});
//--></script> 
<script type="text/javascript"><!--
$('#button-cart').bind('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea'),
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, information, .error').remove();
			
			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						$('#option-' + i).after('<span class="error">' + json['error']['option'][i] + '</span>');
					}
				}
			} 
			
			if (json['success']) {
				$('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
					
				$('.success').fadeIn('slow');
					
				$('#cart-total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow'); 
			}	
		}
	});
});
//--></script>
<script type="text/javascript"><!--
$('#button-review').bind('click', function() {
	$.ajax({
		url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
		type: 'post',
		dataType: 'json',
		data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&rating=' + encodeURIComponent($('input[name=\'rating\']:checked').val() ? $('input[name=\'rating\']:checked').val() : '') + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-review').attr('disabled', true);
			$('#review-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-review').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data['error']) {
				$('#review-title').after('<div class="warning">' + data['error'] + '</div>');
			}
			
			if (data['success']) {
				$('#review-title').after('<div class="success">' + data['success'] + '</div>');
								
				$('input[name=\'name\']').val('');
				$('textarea[name=\'text\']').val('');
				$('input[name=\'rating\']:checked').attr('checked', '');
				$('input[name=\'captcha\']').val('');
			}
		}
	});
});
//--></script> 
<script type="text/javascript"><!--
$('#tabs a').tabs();
//--></script>
<?php echo $footer; ?>